package com.eugene.ui.util;

import java.net.URL;
import org.eclipse.core.runtime.Platform;
import org.osgi.framework.Bundle;

public class URLUtil {

	private URLUtil() {
	}

	public static URL getResourceURL(String s) {
		if (!initialized)
			init();
		URL url = null;
		try {
			url = new URL(baseURL, s);
		} catch (Throwable _ex) {
		}
		return url;
	}

	private static void init() {
//		SQLExplorerPlugin defaultPlugin = SQLExplorerPlugin.getDefault();
//		baseURL = defaultPlugin.getBundle().getEntry("/");
//		initialized = true;
	}

	public static URL getFragmentResourceURL(String yourPluginId,
			String filePath) {
		URL url = null;
		try {
			URL baseURL = Platform.getBundle(yourPluginId).getEntry("/");
			url = new URL(baseURL, filePath);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return url;
	}

	private static boolean initialized = false;
	private static URL baseURL;

}


/*
	DECOMPILATION REPORT

	Decompiled from: C:\Users\kidon\workspace\sqlexplorer/net/sourceforge/sqlexplorer/util/URLUtil.class
	Total time: 20 ms
	Jad reported messages/errors:
	Exit status: 0
	Caught exceptions:
*/